import request from '@/config/axios'

// 分类 VO
export interface DsCategoryVO {
  id: number | null // 编号
  name: string // 名称
  description: string // 描述
  type: string // 类型
  pid: number // 父级ID
  configuration: string // 详细信息
  status: string // 状态
}

// 分类 API
export const DsCategoryApi = {

  //获取分类列表
  getDsCategoryList: async () => {
    return await request.get({ url: `/data/ds-category/list` })
  },

  // 查询分类分页
  getDsCategoryPage: async (params: any) => {
    return await request.get({ url: `/data/ds-category/page`, params })
  },

  // 查询分类详情
  getDsCategory: async (id: number) => {
    return await request.get({ url: `/data/ds-category/get?id=` + id })
  },

  // 新增分类
  createDsCategory: async (data: DsCategoryVO) => {
    return await request.post({ url: `/data/ds-category/create`, data })
  },

  // 修改分类
  updateDsCategory: async (data: DsCategoryVO) => {
    return await request.put({ url: `/data/ds-category/update`, data })
  },

  // 删除分类
  deleteDsCategory: async (id: number) => {
    return await request.delete({ url: `/data/ds-category/delete?id=` + id })
  },

  // 导出分类 Excel
  exportDsCategory: async (params) => {
    return await request.download({ url: `/data/ds-category/export-excel`, params })
  },

  //获取表表名列表
  getTableList: async (params) => {
    return await request.get({ url: `/data/ds-category/table-list` ,params})
  },

    //获取表表名列表
  getTableListByDsId: async (params) => {
    return await request.get({ url: `/data/ds-category/getTableListByDsId` ,params})
  }
}
